import { dealValueIsRight } from '@/pages/commodity/modules/utils/salePriceRequireUtils';
import { generateHighlightNodeForSalePrice } from '@/utils/bizUtils';
export const getMultiplePriceGroupColumnsFn = (data) => {
  let { handleViewOriginalPriceGroup } = data;
  let columns = [
    {
      title: '查看原价格组',
      align: 'center',
      fixed: 'left',
      render: (h, { row }) => {
        return (
          <el-button
            type="text"
            size="large"
            onClick={ () => { handleViewOriginalPriceGroup(row) } }
          >查看</el-button>
        )
      }
    },
    {
      title: 'SKU编码',
      key: 'skuNo',
      align: 'center',
      fixed: 'left'
    },
    {
      title: '商品名称',
      key: 'productName',
      align: 'center',
      fixed: 'left'
    },
    {
      title: '规格',
      key: 'spec',
      align: 'center',
      fixed: 'left'
    },
    {
      title: '价格组',
      key: 'groupName',
      align: 'center'
    },
    {
      title: '城市',
      key: 'cityName',
      align: 'center'
    },
    {
      title: '业务区域',
      key: 'businessArea',
      align: 'center'
    },
    {
      title: '是否敏感商品',
      key: 'isPriceSensitive',
      align: 'center',
      formatter: (row, columns, cellValue) => {
        return cellValue === '1' ? '是' : '否';
      },
    },
    {
      title: '供货计量单位',
      key: 'supplyUnit',
      align: 'center'
    },
    {
      title: '主计量单位',
      key: 'mainUnit',
      align: 'center'
    },
    {
      title: '理论转换率',
      align: 'center',
      render: (h, { row }) => {
        return (<span>{ row.nowInput.theoryConverRate }</span>)
      }
    },
    {
      title: '实际转换率',
      align: 'center',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.nowInput.realConverRate) }</span>)
      }
    },
    {
      title: '售价类型',
      key: 'saleType',
      align: 'center',
      render: (h, { row }) => {
        let saleTypeStr = '';
        if (row.nowInput.saleType === '1') {
          saleTypeStr = '统一售价';
        }
        if (row.nowInput.saleType === '2') {
          saleTypeStr = '区域售价';
        }
        return (<span>{ saleTypeStr }</span>)
      },
    },
    {
      title: '实际转换率辅计量成本价',
      align: 'center',
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.realBackUnitPrice) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.realBackUnitPrice, row.nowInput.realBackUnitPrice)
          }
        }
      ],
    },
    {
      title: '理论转换率辅计量成本价',
      align: 'center',
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.theoryBackUnitPrice) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.theoryBackUnitPrice, row.nowInput.theoryBackUnitPrice)
          }
        }
      ],
    },
    {
      title: '主计量成本价',
      align: 'center',
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.mainUnitPrice) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitPrice, row.nowInput.mainUnitPrice)
          }
        }
      ],
    },
    {
      title: '主计量价浮动比率',
      key: 'mainUnitFloatRate',
      align: 'center'
    },
    {
      title: '加价类型',
      align: 'center',
      render: (h, { row }) => {
        let addPriceTypeName = '';
        if (row.nowInput.addPriceType === '1') {
          addPriceTypeName = '固定金额';
        }
        if (row.nowInput.addPriceType === '2') {
          addPriceTypeName = '比例';
        }
        return (<span>{ addPriceTypeName }</span>)
      }
    },
    {
      title: '销售面价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<span>{ dealValueIsRight(row.oldInput.facePrice2) }</span>)
        }
      },
      {
        title: '现值',
        align: 'center',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.facePrice2, row.nowInput.facePrice2)
        }
      }]
    },
    {
      title: '辅计量现金价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<span>{ dealValueIsRight(row.oldInput.backUnitCashPrice) }</span>)
        }
      },
      {
        title: '现值',
        align: 'center',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.backUnitCashPrice, row.nowInput.backUnitCashPrice)
        }
      }]
    },
    {
      title: '主计量现金价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<span>{ dealValueIsRight(row.oldInput.mainUnitCashPrice) }</span>)
        }
      },
      {
        title: '现值',
        align: 'center',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitCashPrice, row.nowInput.mainUnitCashPrice)
        }
      },
      {
        title: '浮动率',
        align: 'center',
        key: 'cashFloatRate'
      }]
    },
    {
      title: '现金标准加价金额/比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.cashAddRateOrMoney) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.cashAddRateOrMoney, row.nowInput.cashAddRateOrMoney)
          }
        }
      ],
    },
    {
      title: '现金实时加价比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.realCashPriceAddRate) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.realCashPriceAddRate, row.nowInput.realCashPriceAddRate)
          }
        }
      ],
    },
    {
      title: '辅计量分销价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.backUnitDistribPrice) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.backUnitDistribPrice, row.nowInput.backUnitDistribPrice)
          }
        }
      ],
    },
    {
      title: '主计量分销价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.mainUnitDistribPrice) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitDistribPrice, row.nowInput.mainUnitDistribPrice)
          }
        },
        {
          title: '浮动率',
          align: 'center',
          key: 'distribFloatRate'
        },
      ],
    },
    {
      title: '分销与现金差额/差率',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.distribCashDiffRateOrMoney) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.distribCashDiffRateOrMoney, row.nowInput.distribCashDiffRateOrMoney)
          }
        }
      ],
    },
    {
      title: '分销实时加价率',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.realDistribPriceAddRate) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.realDistribPriceAddRate, row.nowInput.realDistribPriceAddRate)
          }
        }
      ],
    },
    {
      title: '现分销与现金差价率',
      align: 'center',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.distribCashDiffRateOrMoney) }</span>)
      }
    },
    {
      title: '辅计量售价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.backUnitSalePrice) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.backUnitSalePrice, row.nowInput.backUnitSalePrice)
          }
        }
      ],
    },
    {
      title: '主计量售价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.mainUnitSalePrice) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitSalePrice, row.nowInput.mainUnitSalePrice)
          }
        },
        {
          title: '浮动率',
          align: 'center',
          key: 'saleFloatRate'
        },
      ],
    },
    {
      title: '售价标准加价率/金额',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.saleAddRateOrMoney) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.saleAddRateOrMoney, row.nowInput.saleAddRateOrMoney)
          }
        }
      ],
    },
    {
      title: '售价实时加价率',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.realSalePriceAddRate) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.realSalePriceAddRate, row.nowInput.realSalePriceAddRate)
          }
        }
      ],
    },
    {
      title: '现金辅计量批量价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.cashBackUnitBatchPrice) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.cashBackUnitBatchPrice, row.nowInput.cashBackUnitBatchPrice)
          }
        }
      ],
    },
    {
      title: '现金辅计量批量加价金额/比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.cashBackUnitAddRateOrMoney) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.cashBackUnitAddRateOrMoney, row.nowInput.cashBackUnitAddRateOrMoney)
          }
        }
      ],
    },
    {
      title: '售价辅计量批量价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.saleBackUnitBatchPrice) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.saleBackUnitBatchPrice, row.nowInput.saleBackUnitBatchPrice)
          }
        }
      ],
    },
    {
      title: '售价辅计量批量加价金额/比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<span>{ dealValueIsRight(row.oldInput.saleBackUnitAddRateOrMoney) }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.saleBackUnitAddRateOrMoney, row.nowInput.saleBackUnitAddRateOrMoney)
          }
        }
      ],
    },
    {
      title: '限制展示价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<span>{ dealValueIsRight(row.oldInput.limitShowPrice) }</span>)
        }
      },
      {
        title: '现值',
        key: 'limitShowPrice',
        align: 'center',
        width: '160',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.limitShowPrice, row.nowInput.limitShowPrice)
        }
      }]
    },
    {
      title: '限制交易价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<span>{ dealValueIsRight(row.oldInput.limitTradePrice) }</span>)
        }
      },
      {
        title: '现值',
        key: 'limitTradePrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.limitTradePrice, row.nowInput.limitTradePrice)
        }
      }]
    }
  ]
  return columns;
}
